﻿@{
    ViewBag.Title = "Tìm kiếm nâng cao";
    Layout = "~/Views/Layout/Default.cshtml";
}
<add assembly="PagedList.Mvc" namespace="PagedList.Mvc" tagprefix="plmvc" />
@using PagedList
@using PagedList.Mvc
<div class="main-holder">
    <div class="main-frame">
        <div id="content">
            <div class="content">
                <div class="box">
                    <h2>Tìm kiếm</h2>
                    <div class="holder">
                        <div class="frame-box">
                            @using (Html.BeginForm("Search", "Product", FormMethod.Post, new {id="timkiem"}))
                            {
                                <div style="padding: 50px;">
                                    <table>
                                        <tr style="height: 8px"></tr>
                                        <tr>

                                            <td style="width: 230px;"><span>Tên sản phẩm</span></td>
                                            <td style="width: 400px">
                                                <input type="text" name="name" class="text long" value="@Context.Session["search_name"]">
                                            </td>
                                        </tr>
                                        <tr style="height: 8px"></tr>
                                        <tr>
                                            <td style="width: 230px;"><span>Danh mục</span></td>
                                            <td style="width: 400px"> @Html.DropDownList("Categories", "Tất cả")</td>
                                        </tr>
                                        <tr style="height: 8px"></tr>
                                        <tr>
                                            <td style="width: 230px;"><span>Thương hiệu</span></td>
                                            <td style="width: 400px">@Html.DropDownList("Manufacturers", "Tất cả")</td>
                                        </tr>
                                        <tr style="height: 8px"></tr>
                                        <tr>
                                            <td style="width: 230px;"><span>Giá</span></td>

                                            <td style="width: 500px">
                                                <small>từ</small>
                                                <input type="text" class="text long" name="from" value="@Context.Session["search_from"]">
                                                <small>đến</small>
                                                <input type="text" class="text long" name="to" value="@Context.Session["search_to"]">
                                            </td>

                                        </tr>
                                        <tr style="height: 8px"></tr>
                                        <tr>
                                            <td></td>
                                            <td>
                                                <div style="width: 210px" id="slider-range"></div>
                                            </td>
                                        </tr>
                                        <tr style="height: 18px"></tr>
                                        <tr>
                                            <td colspan="5" style="text-align:right">
                                                <a href="~/Product/Refresh" class="more" style="float:right;">Nhập lại</a>
                                                <a href="javascript:{}" onclick="document.getElementById('timkiem').submit(); return false;" class="more" style="float:right;">Tìm kiếm</a>
                                            </td>
                                            
                                            <td>
                                            </td>
                                        </tr>
                                    </table>
                                   

                                </div>

                               
                                
                            }
                        </div>
                    </div>
                </div>
                <div class="box">
                    <h2>Kết quả - @ViewBag.Count kết quả được tìm thấy</h2>
                    <div class="holder">
                        <div class="frame-box">
                            <div class="blocks-holder">
                                @{PagedList<Biz.Product> Products = ViewBag.Products;}
                                @foreach (var p in Products)
                                {
                                    <div class="block">
                                        <figure>
                                            <img src="/Images/Products/img3.jpg" width="183" height="135" alt="" />
                                            <h3><a href="/Product/Detail/@p.Id">@p.Name</a></h3>
                                            @{string html = String.Format("{0:C}", p.CurrentPrice);}
                                            <span class="price">@html.Replace('$',' ') VNĐ</span>
                                        </figure>
                                        <div class="btns-holder">
                                            <a href="#" class="add">Giỏ hàng</a>
                                            <a href="/Product/Detail/@p.Id" class="detail">Chi tiết</a>
                                        </div>
                                    </div>
                                }
                            </div>
                            @Html.PagedListPager((IPagedList)ViewBag.Products, page => Url.Action("Search", new { page }), PagedListRenderOptions.OnlyShowFivePagesAtATime)
                        </div>

                    </div>

                </div>

            </div>

            <aside id="sidebar">
                @Html.Action("__CategoriesMenu", "Product")
            </aside>
        </div>
    </div>
</div>
